package baiqitun.netfiles.exception;

import baiqitun.akutils.ResultUtil;
import baiqitun.akutils.model.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author kedaji
 */

@Slf4j
@RestControllerAdvice
public class SysExceptionHandler {
    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
    @ExceptionHandler(NetFilesException.class)
    public Result<?> handleNotFoundException(NetFilesException e){
        log.info(e.getMessage(), e);
        return ResultUtil.error("500", e.getMessage());
    }

}
